<?php
require_once ROOT_PATH . '/lib/confs/Conf.php';
require_once ROOT_PATH . '/lib/dao/DMLFunctions.php';
require_once ROOT_PATH . '/lib/dao/SQLQBuilder.php';
require_once ROOT_PATH . '/lib/common/CommonFunctions.php';
require_once ROOT_PATH . '/lib/common/UniqueIDGenerator.php';
require_once ROOT_PATH . '/lib/common/SearchObject.php';

class Level {
    private $id;
    private $position;
    private $level;
    private $responsibility;
    private $accountability;
    private $education;
    private $utilization;
    private $communication;
    private $timeManagement;
    private $adaptabilityFlexibility;
    private $leadership;
    private $jobKnowledge;
    private $workQuality;
    private $decisionMaking;
    private $negotiation;
    private $persuadingInfluencing;
    private $interPersonal;
    private $coachingDelegation;
    private $financialManagement;
    private $english;
    private $certificates;
    private $bidPresales;
    private $clientMeeting;
    private $training;
    private $seminar;
    private $interview;
    private $subLevel;
    private $oldPosition;

    public function __construct($id = null) {
        $this->id = $id;
    }

    public function setId($id) {
        $this->id = $id;
    }
    
    public function getId() {
        return $this->id;
    }
    
    public function getRole() {
        return $this->position;
    }
    
    public function setRole($position) {
        $this->position = $position;
    }
    
     public function getLevel() {
        return $this->level;
    }

    public function setLevel($level) {
        $this->level = $level;
    }
    
    public function getResponsibility() {
        return $this->responsibility;
    }

    public function setResponsibility($responsibility) {
        $this->responsibility = $responsibility;
    }
    
     public function getAccountability() {
        return $this->accountability;
    }

    public function setAccountability($accountability) {
        $this->accountability = $accountability;
    }
    
    public function getEducation() {
        return $this->education;
    }

    public function setEducation($education) {
        $this->education = $education;
    }
    
    public function getUtilization() {
        return $this->utilization;
    }

    public function setUtilization($utilization) {
        $this->utilization = $utilization;
    }
    
     public function getCommunication() {
        return $this->communication;
    }

    public function setCommunication($communication) {
        $this->communication = $communication;
    }
    
     public function getTimeManagement() {
        return $this->timeManagement;
    }

    public function setTimeManagement($time_management) {
        $this->timeManagement = $time_management;
    }
    
    public function getAdaptabilityFlexibility() {
        return $this->adaptabilityFlexibility;
    }

    public function setAdaptabilityFlexibility($adaptability_flexibility) {
        $this->adaptabilityFlexibility = $adaptability_flexibility;
    }
    
    public function getLeadership() {
        return $this->leadership;
    }

    public function setLeadership($leadership) {
        $this->leadership = $leadership;
    }
    
    public function getJobKnowledge() {
        return $this->jobKnowledge;
    }

    public function setJobKnowledge($job_knowledge) {
        $this->jobKnowledge = $job_knowledge;
    }
    
    public function getWorkQuality() {
        return $this->workQuality;
    }

    public function setWorkQuality($work_quality) {
        $this->workQuality= $work_quality;
    }
    
    public function getDecisionMaking() {
        return $this->decisionMaking;
    }

    public function setDecisionMaking($decision_making) {
        $this->decisionMaking = $decision_making;
    }
    
     public function getNegotiation() {
        return $this->negotiation;
    }

    public function setNegotiation($negotiation) {
        $this->negotiation = $negotiation;
    }
    
     public function getPersuadingInfluencing() {
        return $this->persuadingInfluencing;
    }

    public function setPersuadingInfluencing($persuading_influencing) {
        $this->persuadingInfluencing = $persuading_influencing;
    }
    
     public function getInterPersonal() {
        return $this->interPersonal;
    }

    public function setInterPersonal($inter_personal) {
        $this->interPersonal = $inter_personal;
    }
    
    public function getCoachingDelegation() {
        return $this->coachingDelegation;
    }

    public function setCoachingDelegation($coaching_delegation) {
        $this->coachingDelegation = $coaching_delegation;
    }
    
    public function getFinancialManagement() {
        return $this->financialManagement;
    }

    public function setFinancialManagement($financial_management) {
        $this->financialManagement = $financial_management;
    }
    
    public function getEnglish() {
        return $this->english;
    }

    public function setEnglish($english) {
        $this->english = $english;
    }
    
    public function getCertificates() {
        return $this->certificates;
    }

    public function setCertificates($certificates) {
        $this->certificates = $certificates;
    }
    
    public function getBidPresales() {
        return $this->bidPresales;
    }

    public function setBidPresales($bid_presales) {
        $this->bidPresales = $bid_presales;
    }
    
    public function getClientMeeting() {
        return $this->clientMeeting;
    }

    public function setClientMeeting($client_meeting) {
        $this->clientMeeting = $client_meeting;
    }
    
    public function getTraining() {
        return $this->training;
    }

    public function setTraining($training) {
        $this->training = $training;
    }
    
    public function getSeminar() {
        return $this->seminar;
    }

    public function setSeminar($seminar) {
        $this->seminar = $seminar;
    }
    
    public function getInterview() {
        return $this->interview;
    }

    public function setInterview($interview) {
        $this->interview = $interview;
    }
    
    public function getSubLevel() {
        return $this->subLevel;
    }

    public function setSubLevel($sub_level) {
        $this->subLevel = $sub_level;
    }
    
    public function getOldPosition() {
        return $this->oldPosition;
    }

    public function setOldPosition($oldPosition) {
        $this->oldPosition = $oldPosition;
    }

    public static function getAll() {

        return self::_getList();
    }

    public static function _getList() {
        $fields[0] = "a.id";
        $fields[1] = "a.position";
        $fields[2] = "a.level";
        $fields[3] = "a.responsibility";
        $fields[4] = "a.accountability";
        $fields[5] = "a.education";
        $fields[6] = "a.communication";
        $fields[7] = "a.time_management";
        $fields[8] = "a.adaptability_flexibility";
        $fields[9] = "a.leadership";
        $fields[10] = "a.job_knowledge";
        $fields[11] = "a.work_quality";
        $fields[12] = "a.decision_making";
        $fields[13] = "a.negotiation";
        $fields[14] = "a.persuading_influencing";
        $fields[15] = "a.inter_personal";
        $fields[16] = "a.coaching_delegation";
        $fields[17] = "a.financial_management";
        $fields[18] = "a.english";
        $fields[19] = "a.certificates";
        $fields[20] = "a.bid_presales";
        $fields[21] = "a.client_meeting";
        $fields[22] = "a.training";
        $fields[23] = "a.seminar";
        $fields[24] = "a.interview";
        $fields[25] = "a.sub_level";        
        $fields[26] = "a.old_position";
        $fields[27] = "a.utilization";
              
        $tables = 'hs_hr_level' . ' a';

        $sqlBuilder = new SQLQBuilder();
        $sql = $sqlBuilder->simpleSelect($tables, $fields);
        $actList = array();

        $conn = new DMLFunctions();
        $result = $conn->executeQuery($sql);
        
        while ($result && ($row = mysql_fetch_assoc($result))) {
            $actList[] = self::_createFromRow($row);
        }
        return $actList;
    }
    private static function _createFromRow($row) {
        $level = new Level($row["id"]);
        $level->setRole($row["position"]);
        $level->setLevel($row["level"]);
        $level->setResponsibility($row["responsibility"]);
        $level->setAccountability($row["accountability"]);
        $level->setEducation($row["education"]);
        $level->setCommunication($row["communication"]);
        $level->setTimeManagement($row["time_management"]);
        $level->setAdaptabilityFlexibility($row["adaptability_flexibility"]);
        $level->setLeadership($row["leadership"]);
        $level->setJobKnowledge($row["job_knowledge"]);
        $level->setWorkQuality($row["work_quality"]);
        $level->setDecisionMaking($row["decision_making"]);
        $level->setNegotiation($row["negotiation"]);
        $level->setPersuadingInfluencing($row["persuading_influencing"]);
        $level->setInterPersonal($row["inter_personal"]);
        $level->setCoachingDelegation($row["coaching_delegation"]);
        $level->setFinancialManagement($row["financial_management"]);
        $level->setEnglish($row["english"]);
        $level->setCertificates($row["certificates"]);
        $level->setBidPresales($row["bid_presales"]);
        $level->setClientMeeting($row["client_meeting"]);
        $level->setTraining($row["training"]);
        $level->setSeminar($row["seminar"]);
        $level->setInterview($row["interview"]);
        $level->setSubLevel($row["sub_level"]);        
        $level->setOldPosition($row["old_position"]);
         $level->setUtilization($row["utilization"]);
        
        return $level;      
    }

}

?>
